Skip to content

fix(hermes): Policy.ts CLI no longer discards the destination when --launcher is absent - #1863

Closed
hjbrandt wants to merge 1 commit into
danielmiessler:mainfrom
hjbrandt:fix/policy-cli-dest-without-launcher
Closed

fix(hermes): Policy.ts CLI no longer discards the destination when --launcher is absent#1863
hjbrandt wants to merge 1 commit into
danielmiessler:mainfrom
hjbrandt:fix/policy-cli-dest-without-launcher

Conversation

@hjbrandt

Copy link
Copy Markdown

Fixes #1859.

Policy.ts's CLI filters --launcher and its value out of argv before reading the positional destination:

const positional = argv.filter((a, i) => a !== "--launcher" && i !== launcherIdx + 1);

When --launcher is absent, launcherIdx is -1 and i !== launcherIdx + 1 excludes index 0 — the destination itself. bun Policy.ts <dest> then prints to stdout and never writes the file, exit 0.

Change (one file, LifeOS/install/LIFEOS/HERMES/Policy.ts): guard the sentinel value so the value-slot exclusion only applies when --launcher was actually passed.

Verified: bun Policy.ts /tmp/policy.json writes the file and prints the ✓ policy v… line; bun Policy.ts --launcher name /tmp/policy.json unchanged; no-arg stdout form unchanged.

…launcher is absent

When --launcher is not passed, launcherIdx is -1 and the filter's
'i !== launcherIdx + 1' excludes argv[0] — the destination itself —
so 'bun Policy.ts <dest>' prints to stdout and never writes the file,
exit 0. Guard the sentinel: only skip the value slot when --launcher
was actually passed.

Fixes danielmiessler#1859
@danielmiessler

Copy link
Copy Markdown
Owner

Ported with credit at the site (LIFEOS/HERMES/Policy.ts, your exact guard) and verified: bun Policy.ts /tmp/x.json writes the file, both other forms unchanged. Closing per the port-into-source flow—the public repo is generated from the private tree, so merging here would be overwritten at the next release; the fix ships with your name on it. Thanks.

@hjbrandt
hjbrandt deleted the fix/policy-cli-dest-without-launcher branch August 19, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Policy.ts CLI silently discards its destination argument when --launcher is absent

2 participants